import request from '@/utils/request'
const module="/admin/system/role";

export const selectRoles = (pageNum,pageSize,roleName) => {
    return request({
      url: `${module}/list/${pageNum}/${pageSize}`,
      method: 'get',
      params:{roleName}
    })
  }

  export const addRole = (sysRole) => {
    return request({
      url: `${module}/add`,
      method: 'post',
      data:sysRole
    })
  }

  export const deleteRole = (id) => {
    return request({
      url: `${module}/delete/${id}`,
      method: 'delete',
    })
  }
  export const updateRole = (sysRole) => {
    return request({
      url: `${module}/update`,
      method: 'put',
      data:sysRole
    })
  }
  export const getAllRoles = (userId) => {
    return request({
        url: `${module}/allRoles/${userId}`,
        method: 'get'
    })
}

export const assignMenus2Role = (menuIds,roleId) => {
  return request({
      url: `/admin/system/roleMenu/assignMenus2Role/${roleId}`,
      method: 'put',
      data:menuIds
  })
}

